package com.cctc.mychat.client.command.impl.manager;

import com.cctc.mychat.client.command.Command;
import com.cctc.mychat.client.command.impl.AbstractCommand;
import com.cctc.mychat.client.command.impl.ChatCommand;
import com.cctc.mychat.client.command.impl.LoginCommand;
import com.cctc.mychat.client.command.impl.LogoutCommand;
import io.netty.channel.Channel;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class ManagerCommand extends AbstractCommand {
    private static final Map<String, Command> COMMAND_MAP = new HashMap<>();

    static {
        COMMAND_MAP.put("chat", new ChatCommand());
        COMMAND_MAP.put("logout", new LogoutCommand());
    }

    @Override
    protected void run(Scanner scanner, Channel channel) {
        COMMAND_MAP.get(scanner.next()).exec(scanner, channel);
    }
}
